home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / wtek0693.zip / OOPALLEY.ZIP / LIST.H < prev    next >
C/C++ Source or Header  |  1993-04-27  |  3KB  |  60 lines

  1. #ifndef LINKEDLIST_H
  2. #define LINKEDLIST_H
  3.  
  4. #include "seqcltn.h"
  5. #include "link.h"
  6.  
  7. extern const Class class_LinkedList;
  8.  
  9. ////////////////////////////////////////////////////////////
  10. // class LinkedList (declaration)
  11. ////////////////////////////////////////////////////////////
  12. class LinkedList : public SeqCltn {
  13.     Link*       firstLink;    // pointer to first Link of list 
  14.     Link*       lastLink;     // pointer to last Link of list 
  15.     unsigned    count;     // count of items on list 
  16.  
  17.                 // private member functions
  18.     void        errDblLnk(const char* fn, const Link& lnk) const;
  19.     void        errEmpty(const char* fn) const;
  20.     void        errNotFound(const char* fn, const Object& ob) const;
  21. public:
  22.                 // constructors, destructors
  23.                 LinkedList();
  24.  
  25.                 // operators
  26.     bool        operator!=(const LinkedList& a) const   { return !(*this==a); }
  27.     bool        operator==(const LinkedList&) const;
  28.     Object*&    operator[](int i) const;
  29.  
  30.     virtual Object*         add(const Object&);
  31.     virtual Collection&     addContentsTo(Collection& cltn) const;
  32.     virtual Object*         addFirst(const Object& ob);
  33.     virtual Object*         addLast(const Object& ob);
  34.     virtual Object*&        at(int i) const;
  35.     virtual void            atAllPut(const Object& ob);
  36.     virtual void            deepenShallowCopy();
  37.     virtual Object*         doNext(Iterator&) const;
  38.     virtual Object*         first() const;
  39.     virtual unsigned        hash() const;
  40.     virtual int             indexOf(const Object& ob) const;
  41.     virtual int             indexOfSubCollection(const SeqCltn& cltn, 
  42.                                                  int start=0) const;
  43.     virtual const Class*    isA() const;
  44.     virtual bool            isEmpty()  const;
  45.     virtual bool            isEqual(const Object&) const;
  46.     virtual Object*         last() const;
  47.     virtual unsigned        occurrencesOf(const Object&) const;
  48.     virtual void            printOn(ostream& strm) const;
  49.     virtual Object*         remove(const Object&);
  50.     virtual Object*         removeFirst();
  51.     virtual Object*         removeLast();
  52.     virtual void            replaceFrom(int start, int stop,
  53.                                         const SeqCltn& replacement, int startAt =0);
  54.     virtual void            reSize(unsigned newSize);
  55.     virtual unsigned        size() const;
  56.     virtual const Class*    species() const;
  57. };
  58.  
  59. #endif
  60.